/*    */ package com.chw.admin.customer;
/*    */ 
/*    */ import com.chw.annotation.PermissionSecurity;
/*    */ import com.chw.common.ServiceData;
/*    */ import com.chw.common.ServiceData.RetCode;
/*    */ import com.github.pagehelper.PageInfo;
/*    */ import com.google.gson.Gson;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ import org.springframework.web.bind.annotation.ResponseBody;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/customer"})
/*    */ public class ChwCustomerController
/*    */ {
/*    */ 
/*    */   @Autowired
/*    */   private IChwCustomerService chwCustomerService;
/*    */ 
/*    */   @RequestMapping(value={"/findChwCustomer.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="查询", module="客户信息", btnfunc="chw_customer")
/*    */   public ServiceData find(HttpServletRequest request, ChwCustomer chwCustomer, Integer currentPage, Integer pageSize)
/*    */     throws Exception
/*    */   {
/* 31 */     ServiceData ret = new ServiceData();
/*    */ 
/* 33 */     PageInfo chw = this.chwCustomerService.find(chwCustomer, currentPage, pageSize);
/* 34 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 35 */     ret.setBo(chw);
/* 36 */     return ret;
/*    */   }
/*    */   @RequestMapping(value={"/saveChwCustomer.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="新增", module="新增客户管理", btnfunc="add_chw_customer")
/*    */   public ServiceData add(HttpServletRequest request, String param) throws Exception {
/* 45 */     ServiceData ret = new ServiceData();
/* 46 */     Gson gson = new Gson();
/* 47 */     ChwCustomer chwCustomer = (ChwCustomer)gson.fromJson(param, ChwCustomer.class);
/*    */ 
/* 49 */     int i = this.chwCustomerService.save(chwCustomer);
/* 50 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 51 */     ret.setBo(Integer.valueOf(i));
/* 52 */     return ret;
/*    */   }
/* 60 */   @RequestMapping(value={"/updateChwCustomer.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="修改", module="修改客户管理", btnfunc="update_Customer")
/*    */   public ServiceData update(HttpServletRequest request, String param) throws Exception { ServiceData ret = new ServiceData();
/* 61 */     Gson gson = new Gson();
/* 62 */     ChwCustomer chwCustomer = (ChwCustomer)gson.fromJson(param, ChwCustomer.class);
/*    */ 
/* 64 */     int i = this.chwCustomerService.update(chwCustomer);
/* 65 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 66 */     ret.setBo(Integer.valueOf(i));
/* 67 */     return ret; } 
/*    */   @RequestMapping(value={"/delChwCustomer.do"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   @PermissionSecurity(name="删除", module="删除客户管理", btnfunc="del_Customer")
/*    */   public ServiceData del(HttpServletRequest request, String id, HttpServletResponse response) throws Exception {
/* 75 */     ServiceData ret = new ServiceData();
/*    */ 
/* 77 */     int i = this.chwCustomerService.delVendor(id);
/* 78 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 79 */     ret.setBo(Integer.valueOf(i));
/* 80 */     return ret;
/*    */   }
/*    */   @RequestMapping(value={"/findChwCustomerById.notPermSc"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}, consumes={"*/*"}, produces={"application/json"})
/*    */   @ResponseBody
/*    */   public ServiceData findById(HttpServletRequest request, String id) throws Exception {
/* 87 */     ServiceData ret = new ServiceData();
/*    */ 
/* 89 */     ChwCustomer rta = this.chwCustomerService.findById(id);
/* 90 */     ret.setCode(request, ServiceData.RetCode.Success);
/* 91 */     ret.setBo(rta);
/* 92 */     return ret;
/*    */   }
/*    */ }

/* Location:           E:\chenya\haha\admin java\customer\
 * Qualified Name:     com.chw.admin.customer.ChwCustomerController
 * JD-Core Version:    0.6.0
 */